.class public Lorg/microemu/app/classloader/MIDletClassLoaderConfig;
.super Ljava/lang/Object;
.source "MIDletClassLoaderConfig.java"


# static fields
.field public static final DELEGATION_DELEGATING:I = 0x2

.field public static final DELEGATION_RELAXED:I = 0x1

.field public static final DELEGATION_STRICT:I = 0x0

.field public static final DELEGATION_SYSTEM:I = 0x3


# instance fields
.field appclasses:Ljava/util/List;

.field appclasspath:Ljava/util/List;

.field private delegationSelected:Z

.field private delegationType:I


# direct methods
.method public constructor <init>()V
    .locals 2

    .prologue
    const/4 v1, 0x0

    .line 52
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 48
    new-instance v0, Ljava/util/Vector;

    invoke-direct {v0}, Ljava/util/Vector;-><init>()V

    iput-object v0, p0, Lorg/microemu/app/classloader/MIDletClassLoaderConfig;->appclasses:Ljava/util/List;

    .line 50
    new-instance v0, Ljava/util/Vector;

    invoke-direct {v0}, Ljava/util/Vector;-><init>()V

    iput-object v0, p0, Lorg/microemu/app/classloader/MIDletClassLoaderConfig;->appclasspath:Ljava/util/List;

    .line 53
    iput-boolean v1, p0, Lorg/microemu/app/classloader/MIDletClassLoaderConfig;->delegationSelected:Z

    .line 54
    iput v1, p0, Lorg/microemu/app/classloader/MIDletClassLoaderConfig;->delegationType:I

    .line 55
    return-void
.end method


# virtual methods
.method public addAppClass(Ljava/lang/String;)V
    .locals 2
    .parameter "className"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lorg/microemu/app/ConfigurationException;
        }
    .end annotation

    .prologue
    .line 95
    iget v0, p0, Lorg/microemu/app/classloader/MIDletClassLoaderConfig;->delegationType:I

    const/4 v1, 0x3

    if-ne v0, v1, :cond_0

    .line 96
    new-instance v0, Lorg/microemu/app/ConfigurationException;

    const-string v1, "Can\'t extend system CLASSPATH"

    invoke-direct {v0, v1}, Lorg/microemu/app/ConfigurationException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 98
    :cond_0
    iget-object v0, p0, Lorg/microemu/app/classloader/MIDletClassLoaderConfig;->appclasses:Ljava/util/List;

    invoke-interface {v0, p1}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 99
    return-void
.end method

.method public addAppClassPath(Ljava/lang/String;)V
    .locals 2
    .parameter "path"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lorg/microemu/app/ConfigurationException;
        }
    .end annotation

    .prologue
    .line 88
    iget v0, p0, Lorg/microemu/app/classloader/MIDletClassLoaderConfig;->delegationType:I

    const/4 v1, 0x3

    if-ne v0, v1, :cond_0

    .line 89
    new-instance v0, Lorg/microemu/app/ConfigurationException;

    const-string v1, "Can\'t extend system CLASSPATH"

    invoke-direct {v0, v1}, Lorg/microemu/app/ConfigurationException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 91
    :cond_0
    iget-object v0, p0, Lorg/microemu/app/classloader/MIDletClassLoaderConfig;->appclasspath:Ljava/util/List;

    invoke-interface {v0, p1}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 92
    return-void
.end method

.method public getDelegationType(Z)I
    .locals 1
    .parameter "forJad"

    .prologue
    .line 76
    iget-boolean v0, p0, Lorg/microemu/app/classloader/MIDletClassLoaderConfig;->delegationSelected:Z

    if-nez v0, :cond_0

    if-nez p1, :cond_0

    .line 77
    const/4 v0, 0x1

    .line 79
    :goto_0
    return v0

    :cond_0
    iget v0, p0, Lorg/microemu/app/classloader/MIDletClassLoaderConfig;->delegationType:I

    goto :goto_0
.end method

.method public isClassLoaderDisabled()Z
    .locals 2

    .prologue
    .line 84
    iget v0, p0, Lorg/microemu/app/classloader/MIDletClassLoaderConfig;->delegationType:I

    const/4 v1, 0x3

    if-ne v0, v1, :cond_0

    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public setDelegationType(Ljava/lang/String;)V
    .locals 3
    .parameter "delegationType"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lorg/microemu/app/ConfigurationException;
        }
    .end annotation

    .prologue
    const/4 v1, 0x1

    .line 58
    const-string v0, "strict"

    invoke-virtual {v0, p1}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 59
    const/4 v0, 0x0

    iput v0, p0, Lorg/microemu/app/classloader/MIDletClassLoaderConfig;->delegationType:I

    .line 72
    :goto_0
    iput-boolean v1, p0, Lorg/microemu/app/classloader/MIDletClassLoaderConfig;->delegationSelected:Z

    .line 73
    return-void

    .line 60
    :cond_0
    const-string v0, "relaxed"

    invoke-virtual {v0, p1}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_1

    .line 61
    iput v1, p0, Lorg/microemu/app/classloader/MIDletClassLoaderConfig;->delegationType:I

    goto :goto_0

    .line 62
    :cond_1
    const-string v0, "delegating"

    invoke-virtual {v0, p1}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_2

    .line 63
    const/4 v0, 0x2

    iput v0, p0, Lorg/microemu/app/classloader/MIDletClassLoaderConfig;->delegationType:I

    goto :goto_0

    .line 64
    :cond_2
    const-string v0, "system"

    invoke-virtual {v0, p1}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_5

    .line 65
    iget-object v0, p0, Lorg/microemu/app/classloader/MIDletClassLoaderConfig;->appclasses:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    if-nez v0, :cond_3

    iget-object v0, p0, Lorg/microemu/app/classloader/MIDletClassLoaderConfig;->appclasspath:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    if-eqz v0, :cond_4

    .line 66
    :cond_3
    new-instance v0, Lorg/microemu/app/ConfigurationException;

    const-string v1, "Can\'t extend system CLASSPATH"

    invoke-direct {v0, v1}, Lorg/microemu/app/ConfigurationException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 68
    :cond_4
    const/4 v0, 0x3

    iput v0, p0, Lorg/microemu/app/classloader/MIDletClassLoaderConfig;->delegationType:I

    goto :goto_0

    .line 70
    :cond_5
    new-instance v0, Lorg/microemu/app/ConfigurationException;

    new-instance v1, Ljava/lang/StringBuffer;

    invoke-direct {v1}, Ljava/lang/StringBuffer;-><init>()V

    const-string v2, "Unknown delegationType ["

    invoke-virtual {v1, v2}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v1

    invoke-virtual {v1, p1}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v1

    const-string v2, "]"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Lorg/microemu/app/ConfigurationException;-><init>(Ljava/lang/String;)V

    throw v0
.end method
